var rc;

function encrypt(str_url) {
    Java.perform(function fn() {
        console.log("begin");
        Java.choose("com.mingning179.networkapi.util.JavaNdk", {
            onMatch: function (x) {
                console.log("find instance :" + x);
                console.log("result of fun(string) encrypt:" + str_url);
                result = x.encryptSrc(Java.use("java.lang.String").$new(str_url));
            },
            onComplete: function () {
                console.log("end");
            }
        })
    });
    return result;
}

function calldu(a, b) {
    // Java.perform(function fn() {
    //         console.log('start');
    //
    //     }
    // );
    console.log('start');
    Java.perform(function () {
        console.log('start hook');
        console.log(a, b);
        var RequestUtilsCls = Java.use('com.shizhuang.duapp.common.utils.RequestUtils');
        console.log(RequestUtilsCls);
        RequestUtilsCls.b.overload('java.util.Map', 'long').implementation = function (a, b) {
            console.log(a, b);
            var rc = this.b(a, b);
            console.log("a= " + a.entrySet().toArray());
            console.log("b= " + b);
            console.log("b1 >>> rc= " + rc);
            send(rc);
            return rc;
        };
    });

    console.log('end');
    return rc;
}

rpc.exports = {
    calldu: calldu,
};